package com.sh.common.enums;

public enum AlgoTaskStatusEnum {
    PENDING("PENDING", "排队中"),
    RUNNING("RUNNING", "运行中"),
    COMPLETED("COMPLETED", "已完成"),
    CANCELLED("CANCELLED", "已终止"),
    FAILED("FAILED", "失败");

    private String code;
    private String name;

    AlgoTaskStatusEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }
    public String getName(){
        return name;
    }

    public static String getNameByCode(String code) {
        for (AlgoTaskStatusEnum taskStatusEnum : AlgoTaskStatusEnum.values()) {
            if (taskStatusEnum.code.equals(code)) {
                return taskStatusEnum.getName();
            }
        }
        return null;
    }

}
